<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
          <a><cite>首页</cite></a>
          <a><cite>会员管理</cite></a>
          <a><cite>基本设置</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
          <ul class="layui-tab-title">
            <li class="layui-this">网站设置</li>
            <li>邮件设置</li>
            <li>关闭网站</li>
          </ul>
          <div class="layui-tab-content" >
            <div class="layui-tab-item layui-show">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>网站名称
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="title" autocomplete="off" placeholder="控制在25个字、50个字节以内" class="layui-input" value="{$info['title']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>描述
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="description" autocomplete="off" placeholder="空制在80个汉字，160个字符以内" class="layui-input" value="{$info['description']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>底部版权信息
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="copyright" autocomplete="off" placeholder="&copy; 2016 X-admin"
                            class="layui-input" value="{$info['copyright']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" lay-submit="" lay-filter="web-info">
                            保存
                        </button>
                    </div>
                </form>
                <div style="height:100px;"></div>
            </div>
            <div class="layui-tab-item">
                 <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>SMTP服务器
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="smtp_host" autocomplete="off" placeholder="smtp.qq.com" class="layui-input" value="{$info['smtp_host']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>SMTP 端口
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="smtp_port" autocomplete="off" placeholder="25"
                            class="layui-input" value="{$info['smtp_port']}">
                        </div>
                    </div>
                     <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>邮箱帐号
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="smtp_user" autocomplete="off" placeholder="邮件服务商申请的帐号"
                            class="layui-input" value="{$info['smtp_user']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>邮箱密码
                        </label>
                        <div class="layui-input-block">
                            
                            <input type="text" name="smtp_pw" autocomplete="off" placeholder="邮件服务商申请的密码"
                            class="layui-input" value="{$info['smtp_pw']}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" lay-submit="" lay-filter="smtp">
                            保存
                        </button>
                    </div>
                </form>
            </div>
            <div class="layui-tab-item">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="AppId" class="layui-form-label">
                            <span class="x-red">*</span>是否开启
                        </label>
                        <div class="layui-input-block">
                          <input type="checkbox"
                          <?php if ($info['web_close']): ?>
                              checked=""
                              value="1"
                          <?php endif ?>
                          name="open" lay-skin="switch" lay-filter="switch-web-close" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="L_repass" class="layui-form-label">
                        </label>
                        <button class="layui-btn" lay-filter="web-close" lay-submit="">
                            保存
                        </button>
                    </div>
                </form>
            </div>
          </div>
        </div> 
    </div>
    <script>
        layui.use(['element','layer','form'], function(){
            $ = layui.jquery;//jquery
          lement = layui.element();//面包导航
          layer = layui.layer;//弹出层
          form = layui.form()
        
         //监听提交(web-info)
          form.on('submit(web-info)', function(data){
            console.log(data.field);
            data.field.type = 'webInfo';
            //发异步，把数据提交给php
            $.post('{:U('admin/system/sys_set')}', {data: data.field}, function(response) {
                if (response.type == 1) {
                    layer.alert(response.info, {icon: 6},function () {
                        window.location.reload();
                    });
                } else if(response.type == 0) {
                    layer.msg(response.info, {icon: 5});
                }
            });
            return false;
          });

          //监听提交(smtp)
          form.on('submit(smtp)', function(data){
            console.log(data.field);
            data.field.type = 'smtp';
            //发异步，把数据提交给php
            $.post('{:U('admin/system/sys_set')}', {data: data.field}, function(response) {
                if (response.type == 1) {
                    layer.alert(response.info, {icon: 6},function () {
                        window.location.reload();
                    });
                } else if(response.type == 0) {
                    layer.msg(response.info, {icon: 5});
                }
            });
            return false;
          });

          //监听提交(web-close)
          form.on('submit(web-close)', function(data){
            console.log(data.field);
            data.field.type = 'webClose';
            //发异步，把数据提交给php
            $.post('{:U('admin/system/sys_set')}', {data: data.field}, function(response) {
                if (response.type == 1) {
                    layer.alert(response.info, {icon: 6},function () {
                        window.location.reload();
                    });
                } else if(response.type == 0) {
                    layer.msg(response.info, {icon: 5});
                }
            });
            return false;
          });

          });
    </script>
</body>